package iotdata

import (
	"context"
	"devops-super/api/iotdata/v1"
	"devops-super/internal/service"
)

// GetPageLst 分页获取物联网数据
func (*ControllerV1) GetPageLst(ctx context.Context, req *v1.IotDataGetPageLstReq) (res *v1.IotDataGetPageLstRes, err error) {
	res = &v1.IotDataGetPageLstRes{}
	res, err = service.Iotdata().GetPageLst(ctx, req)
	return
}

func (*ControllerV1) SummaryPageLst(ctx context.Context, req *v1.IotDataSummaryPageLstReq) (res *v1.IotDataSummaryPageLstRes, err error) {
	res = &v1.IotDataSummaryPageLstRes{}
	res, err = service.Iotdata().SummaryPageLst(ctx, req)
	return
}

// GetOne 获取单条物联网数据
// GetOne 方法调整
func (*ControllerV1) GetOne(ctx context.Context, req *v1.IotDataGetOneReq) (res *v1.IotDataGetOneRes, err error) {
	res, err = service.Iotdata().GetOne(ctx, req)
	return
}

// Del 删除物联网数据
func (c *ControllerV1) Del(ctx context.Context, req *v1.IotDataDelReq) (*v1.IotDataDelRes, error) {
	if err := service.Iotdata().Del(ctx, req); err != nil {
		return nil, err
	}
	return &v1.IotDataDelRes{}, nil
}

func (*ControllerV1) GetOneWave(ctx context.Context, req *v1.IotDataGetOneWaveReq) (res *v1.IotDataGetOneWaveRes, err error) {
	res, err = service.Iotdata().GetOneWave(ctx, req)
	return
}

func (*ControllerV1) GetRealtimeWave(ctx context.Context, req *v1.IotDataGetRealtimeWaveReq) (res *v1.IotDataGetRealtimeWaveRes, err error) {
	res, err = service.Iotdata().GetRealtimeWave(ctx, req)
	return
}
